<?php
namespace Home\Model;
use Think\Model;

class OrganModel extends  Model{
    protected $_validate = array(
        array('name','require','机构名称必须！'),
        array('operator_name','require','运营者姓名必须！'),
        array('operator_id','require','运营者身份证必须！'),
        array('operator_tel','require','运营者手机必须！'),
        array('sms_code','checkSmsCode','手机验证码不正确','callback'),
    );

    protected function checkSmsCode(){
        $smsCode=I('post.phoneCode');
        if($smsCode && $smsCode==session('orgReg_mobileCode') && I('post.operator_tel')==session('orgReg_mobileCode_tel')){
            session('orgReg_mobileCode',null);
            session('orgReg_mobileCode_tel',null);
            session('orgReg_mobileCode_time',null);
            return true;
        }else{
            return false;
        }
    }
}